KUI.Animation = {
	fadeIn: function(id){
		this.fade(id, true);
	},
	fadeOut: function(id){
		this.fade(id, false);
	},
    fade: function(id, flag){
        var target = KUI.get(id);
		target.alpha = flag?1:100;
		target.style.opacity = (target.alpha / 100);
  		target.style.filter = 'alpha(opacity=' + target.alpha + ')';
		var value = target.alpha;
		(function(){
			target.style.opacity = (value / 100);
  			target.style.filter = 'alpha(opacity=' + value + ')';
			if (flag) {
				value++;
				if (value <= 100) {
                	setTimeout(arguments.callee, 15);
            	}
			}
			else {
				value--;
				if (value >= 0) {
                	setTimeout(arguments.callee, 15);
            	}
			}
        })();
    }
}
